Optimal. Leaf size=168 \[ -\frac {a^2 d^2 x}{4 f^2}+\frac {a^2 (c+d x)^3}{2 d}+\frac {4 a^2 d (c+d x) \cos (e+f x)}{f^2}+\frac {a^2 d (c+d x) \cos ^2(e+f x)}{2 f^2}-\frac {4 a^2 d^2 \sin (e+f x)}{f^3}+\frac {2 a^2 (c+d x)^2 \sin (e+f x)}{f}-\frac {a^2 d^2 \cos (e+f x) \sin (e+f x)}{4 f^3}+\frac {a^2 (c+d x)^2 \cos (e+f x) \sin (e+f x)}{2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 168, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 7, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {3398, 3377,
2717, 3392, 32, 2715, 8} \begin {gather*} \frac {a^2 d (c+d x) \cos ^2(e+f x)}{2 f^2}+\frac {4 a^2 d (c+d x) \cos (e+f x)}{f^2}+\frac {2 a^2 (c+d x)^2 \sin (e+f x)}{f}+\frac {a^2 (c+d x)^2 \sin (e+f x) \cos (e+f x)}{2 f}+\frac {a^2 (c+d x)^3}{2 d}-\frac {4 a^2 d^2 \sin (e+f x)}{f^3}-\frac {a^2 d^2 \sin (e+f x) \cos (e+f x)}{4 f^3}-\frac {a^2 d^2 x}{4 f^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 32
Rule 2715
Rule 2717
Rule 3377
Rule 3392
Rule 3398
Rubi steps
\begin {align*} \int (c+d x)^2 (a+a \cos (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)^2+2 a^2 (c+d x)^2 \cos (e+f x)+a^2 (c+d x)^2 \cos ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^3}{3 d}+a^2 \int (c+d x)^2 \cos ^2(e+f x) \, dx+\left (2 a^2\right ) \int (c+d x)^2 \cos (e+f x) \, dx\\ &=\frac {a^2 (c+d x)^3}{3 d}+\frac {a^2 d (c+d x) \cos ^2(e+f x)}{2 f^2}+\frac {2 a^2 (c+d x)^2 \sin (e+f x)}{f}+\frac {a^2 (c+d x)^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {1}{2} a^2 \int (c+d x)^2 \, dx-\frac {\left (a^2 d^2\right ) \int \cos ^2(e+f x) \, dx}{2 f^2}-\frac {\left (4 a^2 d\right ) \int (c+d x) \sin (e+f x) \, dx}{f}\\ &=\frac {a^2 (c+d x)^3}{2 d}+\frac {4 a^2 d (c+d x) \cos (e+f x)}{f^2}+\frac {a^2 d (c+d x) \cos ^2(e+f x)}{2 f^2}+\frac {2 a^2 (c+d x)^2 \sin (e+f x)}{f}-\frac {a^2 d^2 \cos (e+f x) \sin (e+f x)}{4 f^3}+\frac {a^2 (c+d x)^2 \cos (e+f x) \sin (e+f x)}{2 f}-\frac {\left (a^2 d^2\right ) \int 1 \, dx}{4 f^2}-\frac {\left (4 a^2 d^2\right ) \int \cos (e+f x) \, dx}{f^2}\\ &=-\frac {a^2 d^2 x}{4 f^2}+\frac {a^2 (c+d x)^3}{2 d}+\frac {4 a^2 d (c+d x) \cos (e+f x)}{f^2}+\frac {a^2 d (c+d x) \cos ^2(e+f x)}{2 f^2}-\frac {4 a^2 d^2 \sin (e+f x)}{f^3}+\frac {2 a^2 (c+d x)^2 \sin (e+f x)}{f}-\frac {a^2 d^2 \cos (e+f x) \sin (e+f x)}{4 f^3}+\frac {a^2 (c+d x)^2 \cos (e+f x) \sin (e+f x)}{2 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.41, size = 193, normalized size = 1.15 \begin {gather*} \frac {a^2 \left (12 c^2 f^3 x+12 c d f^3 x^2+4 d^2 f^3 x^3+32 d f (c+d x) \cos (e+f x)+2 d f (c+d x) \cos (2 (e+f x))-32 d^2 \sin (e+f x)+16 c^2 f^2 \sin (e+f x)+32 c d f^2 x \sin (e+f x)+16 d^2 f^2 x^2 \sin (e+f x)-d^2 \sin (2 (e+f x))+2 c^2 f^2 \sin (2 (e+f x))+4 c d f^2 x \sin (2 (e+f x))+2 d^2 f^2 x^2 \sin (2 (e+f x))\right )}{8 f^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(563\) vs.
\(2(158)=316\).
time = 0.13, size = 564, normalized size = 3.36 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 535 vs.
\(2 (166) = 332\).
time = 0.32, size = 535, normalized size = 3.18 \begin {gather*} \frac {6 \, {\left (2 \, f x + 2 \, e + \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} c^{2} + 24 \, {\left (f x + e\right )} a^{2} c^{2} + \frac {8 \, {\left (f x + e\right )}^{3} a^{2} d^{2}}{f^{2}} + \frac {24 \, {\left (f x + e\right )}^{2} a^{2} c d}{f} - \frac {24 \, {\left (f x + e\right )}^{2} a^{2} d^{2} e}{f^{2}} - \frac {12 \, {\left (2 \, f x + 2 \, e + \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} c d e}{f} - \frac {48 \, {\left (f x + e\right )} a^{2} c d e}{f} + 48 \, a^{2} c^{2} \sin \left (f x + e\right ) - \frac {96 \, a^{2} c d e \sin \left (f x + e\right )}{f} + \frac {6 \, {\left (2 \, {\left (f x + e\right )}^{2} + 2 \, {\left (f x + e\right )} \sin \left (2 \, f x + 2 \, e\right ) + \cos \left (2 \, f x + 2 \, e\right )\right )} a^{2} c d}{f} + \frac {96 \, {\left ({\left (f x + e\right )} \sin \left (f x + e\right ) + \cos \left (f x + e\right )\right )} a^{2} c d}{f} + \frac {6 \, {\left (2 \, f x + 2 \, e + \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} d^{2} e^{2}}{f^{2}} + \frac {24 \, {\left (f x + e\right )} a^{2} d^{2} e^{2}}{f^{2}} - \frac {6 \, {\left (2 \, {\left (f x + e\right )}^{2} + 2 \, {\left (f x + e\right )} \sin \left (2 \, f x + 2 \, e\right ) + \cos \left (2 \, f x + 2 \, e\right )\right )} a^{2} d^{2} e}{f^{2}} - \frac {96 \, {\left ({\left (f x + e\right )} \sin \left (f x + e\right ) + \cos \left (f x + e\right )\right )} a^{2} d^{2} e}{f^{2}} + \frac {48 \, a^{2} d^{2} e^{2} \sin \left (f x + e\right )}{f^{2}} + \frac {{\left (4 \, {\left (f x + e\right )}^{3} + 6 \, {\left (f x + e\right )} \cos \left (2 \, f x + 2 \, e\right ) + 3 \, {\left (2 \, {\left (f x + e\right )}^{2} - 1\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} d^{2}}{f^{2}} + \frac {48 \, {\left (2 \, {\left (f x + e\right )} \cos \left (f x + e\right ) + {\left ({\left (f x + e\right )}^{2} - 2\right )} \sin \left (f x + e\right )\right )} a^{2} d^{2}}{f^{2}}}{24 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 216, normalized size = 1.29 \begin {gather*} \frac {2 \, a^{2} d^{2} f^{3} x^{3} + 6 \, a^{2} c d f^{3} x^{2} + 2 \, {\left (a^{2} d^{2} f x + a^{2} c d f\right )} \cos \left (f x + e\right )^{2} + {\left (6 \, a^{2} c^{2} f^{3} - a^{2} d^{2} f\right )} x + 16 \, {\left (a^{2} d^{2} f x + a^{2} c d f\right )} \cos \left (f x + e\right ) + {\left (8 \, a^{2} d^{2} f^{2} x^{2} + 16 \, a^{2} c d f^{2} x + 8 \, a^{2} c^{2} f^{2} - 16 \, a^{2} d^{2} + {\left (2 \, a^{2} d^{2} f^{2} x^{2} + 4 \, a^{2} c d f^{2} x + 2 \, a^{2} c^{2} f^{2} - a^{2} d^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{4 \, f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 456 vs.
\(2 (163) = 326\).
time = 0.30, size = 456, normalized size = 2.71 \begin {gather*} \begin {cases} \frac {a^{2} c^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} c^{2} x \cos ^{2}{\left (e + f x \right )}}{2} + a^{2} c^{2} x + \frac {a^{2} c^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {2 a^{2} c^{2} \sin {\left (e + f x \right )}}{f} + \frac {a^{2} c d x^{2} \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} c d x^{2} \cos ^{2}{\left (e + f x \right )}}{2} + a^{2} c d x^{2} + \frac {a^{2} c d x \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} + \frac {4 a^{2} c d x \sin {\left (e + f x \right )}}{f} - \frac {a^{2} c d \sin ^{2}{\left (e + f x \right )}}{2 f^{2}} + \frac {4 a^{2} c d \cos {\left (e + f x \right )}}{f^{2}} + \frac {a^{2} d^{2} x^{3} \sin ^{2}{\left (e + f x \right )}}{6} + \frac {a^{2} d^{2} x^{3} \cos ^{2}{\left (e + f x \right )}}{6} + \frac {a^{2} d^{2} x^{3}}{3} + \frac {a^{2} d^{2} x^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {2 a^{2} d^{2} x^{2} \sin {\left (e + f x \right )}}{f} - \frac {a^{2} d^{2} x \sin ^{2}{\left (e + f x \right )}}{4 f^{2}} + \frac {a^{2} d^{2} x \cos ^{2}{\left (e + f x \right )}}{4 f^{2}} + \frac {4 a^{2} d^{2} x \cos {\left (e + f x \right )}}{f^{2}} - \frac {a^{2} d^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{4 f^{3}} - \frac {4 a^{2} d^{2} \sin {\left (e + f x \right )}}{f^{3}} & \text {for}\: f \neq 0 \\\left (a \cos {\left (e \right )} + a\right )^{2} \left (c^{2} x + c d x^{2} + \frac {d^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.39, size = 207, normalized size = 1.23 \begin {gather*} \frac {1}{2} \, a^{2} d^{2} x^{3} + \frac {3}{2} \, a^{2} c d x^{2} + \frac {3}{2} \, a^{2} c^{2} x + \frac {{\left (a^{2} d^{2} f x + a^{2} c d f\right )} \cos \left (2 \, f x + 2 \, e\right )}{4 \, f^{3}} + \frac {4 \, {\left (a^{2} d^{2} f x + a^{2} c d f\right )} \cos \left (f x + e\right )}{f^{3}} + \frac {{\left (2 \, a^{2} d^{2} f^{2} x^{2} + 4 \, a^{2} c d f^{2} x + 2 \, a^{2} c^{2} f^{2} - a^{2} d^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{8 \, f^{3}} + \frac {2 \, {\left (a^{2} d^{2} f^{2} x^{2} + 2 \, a^{2} c d f^{2} x + a^{2} c^{2} f^{2} - 2 \, a^{2} d^{2}\right )} \sin \left (f x + e\right )}{f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.59, size = 255, normalized size = 1.52 \begin {gather*} \frac {8\,a^2\,c^2\,f^2\,\sin \left (e+f\,x\right )-\frac {a^2\,d^2\,\sin \left (2\,e+2\,f\,x\right )}{2}-16\,a^2\,d^2\,\sin \left (e+f\,x\right )+6\,a^2\,c^2\,f^3\,x+a^2\,c^2\,f^2\,\sin \left (2\,e+2\,f\,x\right )+2\,a^2\,d^2\,f^3\,x^3+a^2\,c\,d\,f\,\cos \left (2\,e+2\,f\,x\right )+16\,a^2\,d^2\,f\,x\,\cos \left (e+f\,x\right )+a^2\,d^2\,f^2\,x^2\,\sin \left (2\,e+2\,f\,x\right )+6\,a^2\,c\,d\,f^3\,x^2+a^2\,d^2\,f\,x\,\cos \left (2\,e+2\,f\,x\right )+16\,a^2\,c\,d\,f\,\cos \left (e+f\,x\right )+8\,a^2\,d^2\,f^2\,x^2\,\sin \left (e+f\,x\right )+16\,a^2\,c\,d\,f^2\,x\,\sin \left (e+f\,x\right )+2\,a^2\,c\,d\,f^2\,x\,\sin \left (2\,e+2\,f\,x\right )}{4\,f^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________